home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / What's New? / Development Kits / Mac OS / USB DDK 1.4.6f4 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-25  |  2.8 KB  |  109 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #define kMouseModuleName    "\pUSBHIDMouseModule"
  22.  
  23. Boolean    immediateError(OSStatus err);
  24. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  25. void     MouseInitiateTransaction(USBPB *pb);
  26. void     MouseCompletionProc(USBPB *pb);
  27. void     WatchDogCompletionProc(USBPB *pb);
  28. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  29. void     ChainJADBProc(void);
  30. void     UnchainJADBProc(void);
  31.  
  32. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  33. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  34. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  35.  
  36. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  37. void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
  38.  
  39. void     USBMouseIn(UInt32 refcon, void * theData);
  40.  
  41. #define kMouseRetryCount    3
  42.  
  43. enum driverstages
  44. {  
  45.     kUndefined = 0,
  46.     kSetProtocol,
  47.     kSetIdleRequest,
  48.     kConfigureInterface,
  49.     kSetRemoteWakeup,
  50.     kFindPipe,
  51.     kReadInterruptPipe,
  52.     kGetPortStatus,
  53.     kResetMouse,
  54.     kResetMouseDelay,
  55.     kPortStatusDelay,
  56.     kReturnFromDriver =     0x1000,
  57.     kRetryTransaction =     0x2000,
  58.     kCompletionInProgess =     0x4000,
  59.     kCompletionPending =     0x8000,
  60.     kStageMask =             0x00ff
  61. };
  62.  
  63. enum watchdogstates
  64. {
  65.     kDelay10Seconds = 1,
  66.     kCheckForAbort
  67. };
  68.  
  69. typedef struct
  70. {
  71.     USBPB                             pb;
  72.     void (*handler)(USBPB             *pb);
  73.     
  74.     Boolean                            intPipeAborted;
  75.     Boolean                            driverRemovalPending;
  76.     
  77.     Boolean                            watchDogActivityFlag;
  78.     Boolean                            watchDogAbortFlag;
  79.     UInt32                            watchDogState;
  80.  
  81.     USBReference                    interfaceRef;
  82.     USBPipeRef                        pipeRef;
  83.     
  84.     USBDeviceDescriptor             deviceDescriptor;
  85.     USBInterfaceDescriptor            interfaceDescriptor;
  86.  
  87.     UInt32                            hidDeviceType;
  88.     UInt8                            hidReport[64];
  89.     UInt32                            maxPacketSize;
  90.     
  91.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  92.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  93.     
  94.     UInt32                            interruptRefcon;
  95.     
  96.     HIDNotificationProcPtr             pNotificationRoutine;
  97.     UInt32                            notificationRefcon;
  98.     
  99.     SInt32                             retryCount;
  100.     SInt32                            transDepth;
  101.     
  102.     CursorDevicePtr                    pCursorDeviceInfo;
  103.     CursorDevice                    cursorDeviceInfo;
  104.     Fixed                            unitsPerInch;
  105.     
  106.     UInt32                            previousState;    // For port status check resume
  107. } usbMousePBStruct;
  108.  
  109. #endif //__MouseModuleH__